#include<iostream>
using namespace std;
int f(long long base,long long power){//快速幂
    long long result=1;
    while (power>0)
    {
        if(power&1){
            result=result*base%100;
        }
            power=power>>1;
            base=(base*base)%100;
    }
        return result;
}
int main(){
    long long n;
    while (cin>>n&&n!=0)
    {
        long long ca=1;
        long long m;
        while (n--)
        {   
            cin>>m;
            cout<<"Case "<<ca<<": "<<(f(4,m-1)+f(2,m-1))%100<<endl;
            ca++;
        }
        cout<<endl;
    }
    
}